package practice10;



public class Klass {
    private int number;
    private String displayName;
    private Student leader;

    public Student getLeader() {
        return leader;
    }

    public void setLeader(Student leader) {
        this.leader = leader;
    }

    public Klass(int number) {
        this.number = number;
    }

    public int getNumber() {
        return number;
    }

    public void setNumber(int number) {
        this.number = number;
    }

    public String getDisplayName() {
        displayName = "Class "+getNumber()+"";
        return displayName;
    }

    public void assignLeader(Student student){
        if (student.getKlass().getNumber() != number){
            System.out.print("It is not one of us.\n");
        }else {
            setLeader(student);
        }

    }
    public void appendMember(Student student){
        student.setKlass(this);
    }

    public boolean isIn(Student student){
        boolean flag =false;
        if (student.getKlass().getNumber() ==number){
            flag = true;
        }
        return flag;
    }

    @Override
    public String toString() {
        return "Klass{" +
                "number=" + number +
                ", displayName='" + displayName + '\'' +
                ", leader=" + leader +
                '}';
    }
}
